


        function checkHover(ind,judge){
            if(judge){
                $('.judge .contn .round .check .ring .item:eq(' + ind + ')').addClass('hover')
                $('.judge .contn .round .check .txt .around:eq(' + ind + ')').addClass('hover');
            }else{
                $('.judge .contn .round .check .ring .item:eq(' + ind + ')').removeClass('hover')
                $('.judge .contn .round .check .txt .around:eq(' + ind + ')').removeClass('hover');
            }
        }

        function checkClick(ind){
            var deg = -150;
            $('main .judge .contn .round .line .solid')[0].style.transform = "rotate(" + (deg + ind * 20) + 'deg)';
            $('.judge .contn .round .check .active').removeClass('active');
            $('.judge .contn .round .check .ring .item:eq(' + ind + ')').addClass('active');
            $('.judge .contn .round .check .txt .around:eq(' + ind + ')').addClass('active');
            for(var n = 0;n < $('.judge .contn .round .check .ring .item').length;n++){
                if(n <= ind){
                    $('.judge .contn .round .check .ring .item:eq(' + n + ')').addClass('cross');
                    $('.judge .contn .round .check .txt .around:eq(' + n + ')').addClass('cross');
                }else{
                    $('.judge .contn .round .check .ring .item:eq(' + n + ')').removeClass('cross');
                    $('.judge .contn .round .check .txt .around:eq(' + n + ')').removeClass('cross');
                }
            }

            $('main .judge .txtBox .active').removeClass('active');
            $('main .judge .txtBox p:eq(' + ind +')').addClass('active');
            txtBoxUpdateH();
        }
        function txtBoxUpdateH(){
            $('main .judge .txtBox').height($('main .judge .txtBox .active')[0].offsetHeight);
        }
        var middle = parseInt($('main .teachers .teacherList .item').length / 2);
        var boxBaseWidth = 17.6;
        var boxBaseHeight = 37.4;
        var boxScaleXbase = 0.45;
        var boxScaleXCalBase = 0.03;
        var boxScaleYCalBase = 0.13;
        var marginBase = 8;
        var marginCalBase = 2.5;
        var opacityCalBase = 0.1;
        var translate3dCalBase = 15;

        var minMarginBase = 10;
        var minMarginCalBase = 4;
        var minBoxScaleXbase = 0.93;

        var intialize = false;
        var widthChange = null;
        function prepareEles(){
            $('main .team .teacherInfo .intro:eq(' + middle + ')').addClass('show');
            $('main .teachers .teacherList .item:eq(' + middle + ')').addClass('middle');
            $('main .teachers .teacherList .item:eq(' + middle + ')')[0].translate3d = 10;
            $('main .teachers .teacherList .item:eq(' + middle + ')')[0].scaleX = 1;
            $('main .teachers .teacherList .item:eq(' + middle + ')')[0].margin = 0;
            $('main .teachers .teacherList .item:eq(' + middle + ')')[0].scaleY = 1;
            $('main .teachers .teacherList .item:eq(' + middle + ')')[0].style.zIndex = middle;
            $('main .teachers .teacherList .item:eq(' + middle + ') .box .shadow')[0].style.opacity = '0.1';
            for(var lft = 0;lft < middle;lft++){
                $('main .teachers .teacherList .item:eq(' + lft + ')').addClass('lft');
                $('main .teachers .teacherList .item:eq(' + lft + ')')[0].translate3d = -(middle - lft) * translate3dCalBase;
                $('main .teachers .teacherList .item:eq(' + lft + ')')[0].margin = -(middle - lft - 1) * marginCalBase - marginBase;
                $('main .teachers .teacherList .item:eq(' + lft + ')')[0].scaleX = boxScaleXbase - (middle - lft) * boxScaleXCalBase;
                $('main .teachers .teacherList .item:eq(' + lft + ')')[0].scaleY = 1 - (middle - lft) * boxScaleYCalBase;
                $('main .teachers .teacherList .item:eq(' + lft + ')')[0].style.zIndex = lft;
                $('main .teachers .teacherList .item:eq(' + lft + ') .box .shadow')[0].style.opacity = String(1 - (lft + 1) * opacityCalBase);
            }
            for(var rht = middle + 1;rht < $('main .teachers .teacherList .item').length;rht++){
                $('main .teachers .teacherList .item:eq(' + rht + ')').addClass('rht');
                $('main .teachers .teacherList .item:eq(' + rht + ')')[0].translate3d = -(rht - middle) * translate3dCalBase;
                $('main .teachers .teacherList .item:eq(' + rht + ')')[0].margin = (rht - middle - 1) * marginCalBase + marginBase;
                $('main .teachers .teacherList .item:eq(' + rht + ')')[0].scaleX = boxScaleXbase - (rht - middle) * boxScaleXCalBase;
                $('main .teachers .teacherList .item:eq(' + rht + ')')[0].scaleY = 1 - (rht - middle) * boxScaleYCalBase;
                $('main .teachers .teacherList .item:eq(' + rht + ')')[0].style.zIndex = middle - (rht - middle);
                $('main .teachers .teacherList .item:eq(' + rht + ') .box .shadow')[0].style.opacity = String(1 - ($('main .teachers .teacherList .item').length - rht - 1) * opacityCalBase);
            }
            for(var i = 0;i < $('main .teachers .teacherList .item').length;i++){
                if($('main .teachers .teacherList .item')[i].className.indexOf('lft') >= 0){
                    $('main .teachers .teacherList .item')[i].style.transform = 'translate3d(-50%,-50%,' + $('main .teachers .teacherList .item')[i].translate3d + 'px) rotateY(-15deg)';
                }else if($('main .teachers .teacherList .item')[i].className.indexOf('middle') >= 0){
                    $('main .teachers .teacherList .item')[i].style.transform = 'translate3d(-50%,-50%,10px)'; 
                }else if($('main .teachers .teacherList .item')[i].className.indexOf('rht') >= 0){
                    $('main .teachers .teacherList .item')[i].style.transform = 'translate3d(-50%,-50%,' + $('main .teachers .teacherList .item')[i].translate3d + 'px) rotateY(15deg)';
                }
                
                var marginLeft = $('main .teachers .teacherList .item')[i].margin + 'vw';
                $('main .teachers .teacherList .item')[i].recordLeft = marginLeft;
                $('main .teachers .teacherList .item')[i].style.marginLeft = marginLeft; 
                $('main .teachers .teacherList .item')[i].style.width = ($('main .teachers .teacherList .item')[i].scaleX * boxBaseWidth + 'vw');
                $('main .teachers .teacherList .item')[i].style.height = ($('main .teachers .teacherList .item')[i].scaleY * boxBaseHeight + 'vw');
            }
            
        }
        function updateData(){
            /*$('main .teachers .teacherList .item.middle')[0].scaleX = $('main .team .teachers')[0].className.indexOf('minWidth') >= 0?1:boxScaleXbase;
            $('main .teachers .teacherList .item.middle')[0].style.width = ($('main .teachers .teacherList .item.middle')[0].scaleX * boxBaseWidth + 'vw');*/
            for(var i = 0;i < $('main .teachers .teacherList .item').length;i++){
                if($('main .teachers .teacherList .item')[i].className.indexOf('middle') >= 0){
                    continue;
                }else{
                    if($('main .teachers')[0].className.indexOf('minWidth') >= 0){
                        console.log('min');
                        if($('main .teachers .teacherList .item')[i].className.indexOf('lft') >= 0){
                            $('main .teachers .teacherList .item')[i].margin += marginBase;
                            $('main .teachers .teacherList .item')[i].margin /= marginCalBase;
                            $('main .teachers .teacherList .item')[i].margin *= minMarginCalBase;
                            $('main .teachers .teacherList .item')[i].margin -= minMarginBase
                            //$('main .teachers .teacherList .item')[i].margin += (marginBase - minMarginBase);
                        }else{
                            $('main .teachers .teacherList .item')[i].margin -= marginBase;
                            $('main .teachers .teacherList .item')[i].margin /= marginCalBase;
                            $('main .teachers .teacherList .item')[i].margin *= minMarginCalBase;
                            $('main .teachers .teacherList .item')[i].margin += minMarginBase
                            //$('main .teachers .teacherList .item')[i].margin += (minMarginBase - marginBase);
                        }
                        $('main .teachers .teacherList .item')[i].scaleX += (minBoxScaleXbase - boxScaleXbase);
                    }else{
                        if($('main .teachers .teacherList .item')[i].className.indexOf('lft') >= 0){
                            $('main .teachers .teacherList .item')[i].margin += minMarginBase;
                            $('main .teachers .teacherList .item')[i].margin /= minMarginCalBase;
                            $('main .teachers .teacherList .item')[i].margin *= marginCalBase;
                            $('main .teachers .teacherList .item')[i].margin -= marginBase;
                            //$('main .teachers .teacherList .item')[i].margin += (minMarginBase - marginBase);
                        }else{
                            $('main .teachers .teacherList .item')[i].margin -= minMarginBase;
                            $('main .teachers .teacherList .item')[i].margin /= minMarginCalBase;
                            $('main .teachers .teacherList .item')[i].margin *= marginCalBase;
                            $('main .teachers .teacherList .item')[i].margin += marginBase;
                            //$('main .teachers .teacherList .item')[i].margin += (marginBase - minMarginBase);
                        }
                        $('main .teachers .teacherList .item')[i].scaleX += (boxScaleXbase - minBoxScaleXbase);
                    }
                    var marginLeft = $('main .teachers .teacherList .item')[i].margin + 'vw';
                    $('main .teachers .teacherList .item')[i].style.marginLeft = marginLeft; 
                    $('main .teachers .teacherList .item')[i].style.marginLeft = marginLeft; 
                    $('main .teachers .teacherList .item')[i].style.width = ($('main .teachers .teacherList .item')[i].scaleX * boxBaseWidth + 'vw');
                }
            }
        }
        function recordMarginLeft(ele){
            var marginLeft = ele.margin + 'vw';
            ele.recordLeft = marginLeft;
        }
        $(document).ready(function(){
            txtBoxUpdateH();
            for(var i = 0;i < $('.judge .contn .round .check .ring .item').length;i++){
                $('.judge .contn .round .check .ring .item')[i].ind = i;
                $('.judge .contn .round .check .txt .around')[i].ind = i;
            }
            for(var t = 0;t < $('main .team .teachers .teacherList .item').length;t++){
                $('main .team .teachers .teacherList .item')[t].ind = t;
            }
            $('.judge .contn .round .check .aim').mouseenter(function(){
                var index = $(this)[0].ind;
                var inOrNot = true;
                checkHover(index,inOrNot)
            })
            $('.judge .contn .round .check .aim').mouseleave(function(){
                var index = $(this)[0].ind;
                var inOrNot = false;
                checkHover(index,inOrNot)
            })
           
            $('.judge .contn .round .check .aim').click(function(){
                var index = $(this)[0].ind;
                checkClick(index);
            })
            
            /*$('main .teachers .teacherList .item').mouseenter(function(){
                if($(this)[0].className.indexOf('middle') >= 0 && $('main .teachers')[0].className.indexOf('minWidth') < 0){
                    $(this)[0].style.width = ''; 
                    $(this).find('.box')[0].style.cssText = "height:100%";
                    $(this).find('.box img')[0].style.cssText = "height:100%";
                    for(var n = 0;n < $('main .teachers .teacherList .item').length;n++){
                        var record = $('main .teachers .teacherList .item')[n].recordLeft;
                        if($('main .teachers .teacherList .item')[n].className.indexOf('lft') >= 0){
                            $('main .teachers .teacherList .item')[n].style.marginLeft = parseFloat(record) - 2.5 + 'vw';
                        }else if($('main .teachers .teacherList .item')[n].className.indexOf('rht') >= 0){
                            $('main .teachers .teacherList .item')[n].style.marginLeft = parseFloat(record) + 2.5 + 'vw';
                        }
                    }
                }
            })*/
            /*$('main .teachers .teacherList .item').mouseleave(function(){
                if($(this)[0].className.indexOf('middle') >= 0 && $('main .teachers')[0].className.indexOf('minWidth') < 0){
                    $(this)[0].style.width = boxScaleXbase * boxBaseWidth + 'vw'; 
                    $(this).find('.box')[0].style.cssText = "";
                    $(this).find('.box img')[0].style.cssText = "";
                    for(var n = 0;n < $('main .teachers .teacherList .item').length;n++){
                        $('main .teachers .teacherList .item')[n].style.marginLeft = $('main .teachers .teacherList .item')[n].recordLeft;
                    }
                }
                
            })*/
            $('main .team .teachers .btn').mouseenter(function(){
                var deg = $(this).find('.red p span')[0].style.transform || 0;
                if(deg != 0){
                    deg = deg.substr(deg.indexOf('(') + 1);
                    deg = deg.replace(')','')
                    deg = parseInt(deg);
                }
                $(this).find('.red').css('transform',('rotate(' + (deg + 180) + 'deg)'));
                $(this).find('.red p span').css('transform',('rotate(' + (deg + 180) + 'deg)'));
            })
            $('main .team .teachers .btn').mouseleave(function(){
                var deg = $(this).find('.red p span')[0].style.transform || 0;
                if(deg != 0){
                    deg = deg.substr(deg.indexOf('(') + 1);
                    deg = deg.replace(')','')
                    deg = parseInt(deg);
                }
                $(this).find('.red').css('transform',('rotate(' + (deg + 180) + 'deg)'));
                $(this).find('.red p span').css('transform',('rotate(' + (deg + 180) + 'deg)'));
            })
            $('main .team .teachers .btn').click(function(){
                if($(this)[0].className.indexOf('prev') >= 0){
                    var record = {
                        style:$('main .teachers .teacherList .item:last-child')[0].style.cssText,
                        margin:$('main .teachers .teacherList .item:last-child')[0].margin,
                        className:$('main .teachers .teacherList .item:last-child')[0].className,
                        opacity:$('main .teachers .teacherList .item:last-child .box .shadow')[0].style.opacity
                    };
                    $('main .teachers .teacherList .item:last-child')[0].style.cssText = $('main .teachers .teacherList .item:first-child')[0].style.cssText;
                    $('main .teachers .teacherList .item:last-child')[0].margin = $('main .teachers .teacherList .item:first-child')[0].margin;
                    $('main .teachers .teacherList .item:last-child')[0].className = $('main .teachers .teacherList .item:first-child')[0].className;
                    $('main .teachers .teacherList .item:last-child .box .shadow')[0].style.opacity = $('main .teachers .teacherList .item:first-child .box .shadow')[0].style.opacity;
                    recordMarginLeft($('main .teachers .teacherList .item:last-child')[0]);
                    for(var p = 0;p < $('main .teachers .teacherList .item').length - 1;p++){
                        if(p == $('main .teachers .teacherList .item').length - 2){
                            $('main .teachers .teacherList .item')[p].style.cssText = record.style;
                            $('main .teachers .teacherList .item')[p].margin = record.margin;
                            $('main .teachers .teacherList .item')[p].className = record.className;
                            $('main .teachers .teacherList .item:eq(' + p + ') .box .shadow')[0].style.opacity = record.opacity;
                            recordMarginLeft($('main .teachers .teacherList .item')[p]);
                            continue;
                        }
                        $('main .teachers .teacherList .item')[p].style.cssText = $('main .teachers .teacherList .item:eq(' + p +')').next()[0].style.cssText;
                        $('main .teachers .teacherList .item')[p].margin = $('main .teachers .teacherList .item:eq(' + p +')').next()[0].margin;
                        $('main .teachers .teacherList .item')[p].className = $('main .teachers .teacherList .item:eq(' + p +')').next()[0].className;
                        $('main .teachers .teacherList .item:eq(' + p + ') .box .shadow')[0].style.opacity = $('main .teachers .teacherList .item:eq(' + (p + 1) + ') .box .shadow')[0].style.opacity
                        recordMarginLeft($('main .teachers .teacherList .item')[p]);
                    }
                }else{
                    var record = {
                        style:$('main .teachers .teacherList .item:first-child')[0].style.cssText,
                        margin:$('main .teachers .teacherList .item:first-child')[0].margin,
                        className:$('main .teachers .teacherList .item:first-child')[0].className,
                        opacity:$('main .teachers .teacherList .item:first-child .box .shadow')[0].style.opacity
                    };
                    $('main .teachers .teacherList .item:first-child')[0].style.cssText = $('main .teachers .teacherList .item:last-child')[0].style.cssText;
                    $('main .teachers .teacherList .item:first-child')[0].margin = $('main .teachers .teacherList .item:last-child')[0].margin;
                    $('main .teachers .teacherList .item:first-child')[0].className = $('main .teachers .teacherList .item:last-child')[0].className;
                    $('main .teachers .teacherList .item:first-child .box .shadow')[0].style.opacity = $('main .teachers .teacherList .item:last-child .box .shadow')[0].style.opacity;
                    recordMarginLeft($('main .teachers .teacherList .item:first-child')[0]);
                    for(var p = 1;p < $('main .teachers .teacherList .item').length;p++){
                        var length = $('main .teachers .teacherList .item').length;
                        if(p == $('main .teachers .teacherList .item').length - 1){
                            $('main .teachers .teacherList .item')[length - p].style.cssText = record.style;
                            $('main .teachers .teacherList .item')[length - p].margin = record.margin;
                            $('main .teachers .teacherList .item')[length - p].className = record.className;
                            $('main .teachers .teacherList .item:eq(' + (length - p) + ') .box .shadow')[0].style.opacity = record.opacity;
                            recordMarginLeft($('main .teachers .teacherList .item')[length - p]);
                            continue;
                        }
                        $('main .teachers .teacherList .item')[length - p].style.cssText = $('main .teachers .teacherList .item:eq(' + (length - p) +')').prev()[0].style.cssText;
                        $('main .teachers .teacherList .item')[length - p].margin = $('main .teachers .teacherList .item:eq(' + (length - p) +')').prev()[0].margin;
                        $('main .teachers .teacherList .item')[length - p].className = $('main .teachers .teacherList .item:eq(' + (length - p) +')').prev()[0].className;
                        $('main .teachers .teacherList .item:eq(' + (length - p) + ') .box .shadow')[0].style.opacity = $('main .teachers .teacherList .item:eq(' + (length - p - 1) + ') .box .shadow')[0].style.opacity
                        recordMarginLeft($('main .teachers .teacherList .item')[length - p]);
                    }
                }
                $('main .team .teacherInfo .intro').removeClass('show');
                $('main .team .teacherInfo .intro:eq(' + $('main .teachers .teacherList .item.middle')[0].ind + ')').addClass('show');
                if($('main .team .teachers')[0].className.indexOf('minWidth') >= 0){
                    for(var i = 0;i < $('main .teachers .teacherList .item').length;i++){
                        $('main .teachers .teacherList .item')[i].children[0].style.cssText = "";
                    }
                    console.log($('main .teachers .teacherList .item.middle')[0].children[0]);
                    $('main .teachers .teacherList .item.middle')[0].children[0].style.cssText = 'width:100%;height:100%';
                }
            })
            widthChange = setInterval(function(){
                if(!intialize){
                    var eleTop = $('main .team .teachers')[0].getBoundingClientRect().top;
                    var ele_h = $('main .team .teachers')[0].offsetHeight;
                    if(window.innerHeight - eleTop >= ele_h * 0.75){
                        intialize = true;
                        $('main .team .teachers').css('opacity','1')
                        prepareEles();
                        return false;
                    }
                }
                if(!intialize) return false;
                if(window.innerWidth < 768 && $('main .team .teachers')[0].className.indexOf('minWidth') < 0){
                    $('main .team .teachers').addClass('minWidth');
                    updateData();
                    $('main .team .teachers .teacherList .item.middle').find('.box')[0].style.cssText = "height:100%";
                    $('main .team .teachers .teacherList .item.middle').find('.box img')[0].style.cssText = "height:100%";
                }else if(window.innerWidth >= 768 && $('main .team .teachers')[0].className.indexOf('minWidth') >= 0){
                    $('main .team .teachers').removeClass('minWidth');
                    updateData();
                    $('main .team .teachers .teacherList .item.middle').find('.box')[0].style.cssText = "";
                }
            },10)
        })